package com.codeoss.framework.codegenerator;

import com.codeoss.framework.data.metadata.Table;

public class ServiceInterfaceGenerator {
	public String generate(Table table){
		StringBuilder sb=new StringBuilder();
		sb.append("package ");
		sb.append(table.getPackageName()).append(".service;");
		Table superTable=table.getSuperTable();
		String superTableName=superTable.getTableName();
		sb.append("import com.codeoss.framework.service.");
		if("base_table".equals(superTableName)) {
			sb.append("IBaseService");
		}else {
			sb.append("IBaseTreeService");
		}
		sb.append(";");
		String className=CodeGeneratorUtil.getClassName(table);
		sb.append(" import ").append(table.getPackageName()).append(".model.").append(className).append(";");
		sb.append(" public interface I").append(className).append("Service extends ");
		if("base_table".equals(superTableName)) {
			sb.append("IBaseService");
		}else {
			sb.append("IBaseTreeService");
		}
		sb.append("<").append(className).append(">{}");
		return sb.toString();
	}
}
